{include file="public/_meta" /}
<title></title>
<style>	
		input{
			width:30px;
			border:none;
		}

</style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>订单管理 <span class="c-gray en">&gt;</span> 订单列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" onclick="excel()" title="导出Excel文档"><i class="Hui-iconfont">&#xe681;</i></ a><a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
	<form class="Huiform" method="get" action="" target="_self">
		状态：
		<span class="select-box inline">
			<select name="or_status" class="select">
				<option value="">全部</option> 
				<option value="0">待支付</option> 
				<option value="1">待发货</option>
				<option value="2">待收货</option>
				<option value="3">已收货</option>
				 <option value="4">已取消</option>
			</select>
		</span>&nbsp;
		类型：
			<span class="select-box inline">
			<select name="ca_id" class="select">
				<option value="">全部</option>
				<option value="1">店主和会员区</option>
				<option value="2">店主区</option>
			</select>
		</span>&nbsp;&nbsp;
<!--		<input type="text" class="input-text" style="width:90px" placeholder="最小金额" name="num_min" value="{$Request.get.num_min|default=''}">-->
<!--		<input type="text" class="input-text" style="width:90px" placeholder="最大金额" name="num_max" value="{$Request.get.num_max|default=''}">-->
		<input type="text" class="input-text" style="width:150px" placeholder="订单号" name="list" value="{$Request.get.list|default=''}">
		日期范围：
		<input type="text" class="input-text Wdate" name="start" id="countTimestart" onfocus="selecttime(1)" value="{$Request.get.start|default=''}" size="17" class="date" readonly style="width:140px;"> 
		- 
		<input type="text" class="input-text Wdate" name="end" id="countTimeend" onfocus="selecttime(2)" value="{$Request.get.end|default=''}" size="17"  class="date" readonly style="width:140px;">
		<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
	</form>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
<!--		<span class="l">-->
<!--			<a href="javascript:;" onclick="create(0,'add','添加订单')" class="btn btn-primary radius">-->
<!--			<i class="Hui-iconfont">&#xe600;</i> 订单</a>-->
<!--		</span>-->
		<span class="r">共有数据：<strong>{$list->total()}</strong> 条</span> </div>

	<div class="mt-20">
	<table class="table table-border  table-hover table-bg table-sort">
		<thead>
			<tr class="text-c">				
				<th>订单编号</th>
				<th>买家信息</th>
				<th>订单类型</th>
				<th>订单详情</th>
				<th>订单状态</th>
				<th>支付方式</th>
				<th>下单时间</th>
				<th>系统操作</th>
			</tr>
		</thead>
		<tbody>
			{volist name='list' id="vo"}
				<tr class="text-c">
					<td>{$vo.or_num}</td>
					<td>{$vo.us_nickname}<br/>{$vo.us_tel}</td>										

					<td>
						{if  $vo.ca_id ==1 } 店主和会员区
						{elseif $vo.ca_id ==2 /}店主区
						{else/}
						{/if}
					</td>
					<td><a href="javascript:;" onclick="showDetail({$vo.id})">[点击查看]</a></td>
					<td>{$vo.status_text}</td>

					<td>
						{if ( $vo.pay_type == 1) } 钱包支付
						{elseif $vo.pay_type == 2 /}微信支付
						{elseif $vo.pay_type == 3 /}支付宝支付
						{elseif $vo.pay_type == 0 /}暂未付款
						{/if}
					</td>
					<td>{$vo.or_add_time}</td>								
					<td class="td-manage">
						</a>	
						<a href="javascript:;" onclick="deliver({$vo.id})">[点击发货]</a>
						<a style="text-decoration:none" onclick="del({$vo.id},'Order')" title="删除"><i class="Hui-iconfont">&#xe706;</i>
					</td>
				</tr>
			{/volist}
		</tbody>
	</table>
	<div class="pages" style="margin:20px;float: right; ">{$list|raw}</div>
</div>
{include file="public/_footer" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript">
	$('select[name="or_status"]').val({$Request.get.or_status});
	$('select[name="or_num"]').val({$Request.get.or_num});
	$('select[name="st_id"]').val({$Request.get.st_id});
function create(id,url,key){
	var url = "{:url('"+url+"')}?id="+id;
	creatIframe(url,key);
}

	function excel(){

		var or_status = $('select[name="or_status"]').val();
		var ca_id = $('select[name="ca_id"]').val();
		// var num_min = $('input[name = "num_min"]').val();
		// var num_max = $('input[name = "num_max"]').val();
		var list = $('input[name = "list"]').val();
		var  start = $('input[name="start"]').val();
		var time_start = Date.parse(start)
		var end = $('input[name="end"]').val();
		var time_send= Date.parse(end)
		var url = "{:url('excel')}?or_status="+or_status+"&ca_id="+ca_id+"&list="+list+"&time_start="+time_start+"&time_send="+time_send;
		creatIframe(url,'表格导出');
		location.href = '';

		// var url = "{:url('excel')}";
		// creatIframe(url,'表格导出');
		// location.href = '';
	}
function change(id,value,key){
	layer.confirm('确定要更改么？', {
	      btn: ['确定', '取消']
	    }, function(index, layero){
	        $.ajax({
	            type: "post",
	            url: "{:url('change')}",
	            data: {id:id,value:value,key:key},
	            success: function(data) {
	             	if(data.code){
	             		location.href = '';
	             	}
	            }
	        });
	    });
}

function del(id,key){
    layer.confirm('确定要删除么？', {
      btn: ['确定', '取消']
    }, function(index, layero){
        $.ajax({
            type: "post",
            url: "{:url('dodelete')}",
            data: {id:id,key:key},
            success: function(data) {
                layer.msg(data.msg);
                if(data.code==1){
                    setTimeout(function(){
                        location.href = data.url;
                    },1000);
                }
            }
        });
    });
}

function showDetail(id){
	var url = "{:url('Order/Detail')}?id="+id;
	layer_show('订单详情',url);
}
function approval(id,tel){
	var url ="{:url('Order/Approval')}?id="+id+"&&tel="+tel;
	layer_show('线下支付审核',url,'1200','600');
}
function deliver(id){
	var url = "{:url('Order/Deliver')}?id="+id;
	layer_show('发货页面',url,'600','300');
}
function selecttime(flag){
    if(flag==1){
        var endTime = $("#countTimeend").val();
        if(endTime != ""){
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:endTime})}else{
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
    }else{
        var startTime = $("#countTimestart").val();
        if(startTime != ""){
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:startTime})}else{
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
    }
 }	
</script> 
</body>
</html>